package javaGUI;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.JPanel;

public class MyPanel extends JPanel {
	
	private int x,y;
	private BufferedImage bi;
	public MyPanel() throws IOException{
		
		bi = ImageIO.read(new File("web/html5app_steam_video.bmp"));
		
		this.addMouseMotionListener(new MouseMotionListener() {
			
			@Override
			public void mouseMoved(MouseEvent e) {
				
			}
			
			@Override
			public void mouseDragged(MouseEvent e) {
				x = e.getX();
				y = e.getY();
				repaint();
				
			}
		});
	}

	@Override
	public void paint(Graphics g) {
		
		Graphics2D g2d = (Graphics2D)g;
		if(bi != null){
			g2d.drawImage(bi, 20, 20, null);
		}
		
		
		/*g2d.setColor(Color.red);
		g2d.fillRect(x, y, 20, 20);*/
		
	}

	
	
}
